<?php
class M_HitCounter extends CI_Model{
    function __construct(){
        parent::__construct();
    }
    function hitCounter(){
        $this->db->cache_off();
        return $this->db->count_all('hits');
    }

    function online(){
        $this->db->cache_off();
        return $this->db->count_all('ci_sessions');
    }

    function userAgent(){
        $this->db->cache_off();
        $sql = "SELECT user_agent AS browser, COUNT( * ) AS totals
                FROM  hits 
                GROUP BY user_agent";
        $query = $this->db->query($sql);
        return $query->result_array();
    }
}
 
